<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>in与hasOwnProperty的属性检测差异</title>
  </head>
  <body></body>
  <script>
    let a = { url: "houdunren" };
    let b = { name: "后盾人" };
    Object.setPrototypeOf(a, b);
    //in操作符会检测原型链上的属性
    console.log("url" in a);
    console.log("name" in a);

    console.log(a.hasOwnProperty("url"));
    console.log(a.hasOwnProperty("name"));
  </script>
</html>
